Repository navigation
Sync practical-k-means with the updated tutorial - #949
Merged
realpython-bot merged 1 commit intoNov 23, 2026
Merged
Conversation
…ing in Python: A Practical Guide Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
realpython-bot
deleted the
maintenance/k-means-clustering-python-20261123
branch
November 23, 2026 07:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Maintenance sync of
practical-k-means/with the update of K-Means Clustering in Python: A Practical Guide.What changed and why
practical-k-means-syntethic.ipynb:silhouette_score()now returns a Pythonfloat, so.round(2)raisedAttributeError. The cell now usesround(..., 2), matching the updated article.practical-k-means-cancer-gene-expression.ipynb:sns.scatterplot()no longer accepts positionalx/ydata, so the cell now passesx=andy=keywords.requirements.txt: every line pinned with==to the versions the article'sdependenciesfield now carries (scikit-learn 1.9.1, kneed 0.9.0, matplotlib 3.11.2, numpy 2.5.5, pandas 3.1.1, seaborn 0.13.2), plus jupyter 1.1.1.README.md: conda commands match the article's pinned conda-forge install, and thejupyter notebookcommands now name the notebooks' actual filenames.Stored notebook outputs are left as they were to keep the diff reviewable.
Links
Verification
pip install -r requirements.txt, then both notebooks executed end to end withMPLBACKEND=Agg jupyter nbconvert --execute(including the TCGA dataset download): no errors, no stderr output.uvx ruff@0.14.1 format --check practical-k-meansanduvx ruff@0.14.1 check practical-k-meansboth pass.🤖 Generated with Claude Code